<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="<s:url value='/resources/css/control.style.css'/>" />
<link rel="stylesheet" type="text/css" href="<s:url value='/resources/css/control.theme.css'/>" />
<script src="<s:url value='/resources/js/jquery/jquery-1.5.2.min.js'/>" type="text/javascript"></script>
<script src="<s:url value='/resources/js/car/control.datagrid.js'/>" type="text/javascript"></script>
<script type="text/javascript">
var contextpath="<%=request.getContextPath()%>";
$(function(){
	
	$('#dataGrid').DataGrid({
		url: '<s:url value="/control/findMenus.do?menu.mealid=%{#request.mealId}"/>',
		pageSize: 10,
		columns:[
			{field:'mealid',title:'序号',width: '20%',align:'center'},
			{field:'mealName',title:'套餐名称',width: '40%'},
			{field:'price',title:'价格（元）',width: '20%',align:'center'},
			{field:'total',title:'数量（个）',width: '20%',align:'center'},
			
		],
		onBeforeLoad: function(param){
			
		},
		onLoadSuccess: function(total,rows){
			if(parent.reSetHeight){
				parent.reSetHeight(0);
			}
			mergerCell($('#dataGrid'),['mealid','mealName']);
		}
	});
	
	function mergerCell(grid,fields){//合并单元格
		for(var x in fields){
			 var field = fields[x];
			 var $tdFields = grid.find('td[field="'+field+'"]');
			 for(var i=0; i< $tdFields.size(); i++){
				 var $td = $tdFields.eq(i);
				 var val = $td.text();
				 var rowspan = 1;
				 for(var j=i+1; j< $tdFields.size(); j++){
					if(val==$tdFields.eq(j).text()){
						rowspan += 1;
						$td.attr('rowspan',rowspan);
						$tdFields.eq(j).remove();
					}else{
						break;
					}
				 }
			 }
		}
	}
	
	function findDetail(id){
		
	}
});
</script>
<title><s:property value="#request.place.name"/></title>
</head>
<body>
	<div id="box">
		<h3>[<s:property value="#request.place.name"/>]申报的套餐查询</h3>
		<div id="dataGrid"></div>
		<table>
			<tr>
				<td align="right"><input type="button" value="点击返回" onclick="window.location.href='<s:url value="/control/showFoods.do"/>'"/></td>
			</tr>
		</table>
	</div>
</body>
</html>